{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# OpenGL 学习笔记 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 1 Introduction"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "OpenGL \n",
    "* what it is?\n",
    "* How it acts?\n",
    "* What is required t implement it?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**programming shading**\n",
    "* important concepts and objects"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.2 \n",
    "\n",
    "API to graphics hardware\n",
    "\n",
    "The API consists of a set of several hundred procedures and functions involved \n",
    "* shader programs\n",
    "* objects\n",
    "* operations\n",
    "involved in producing high-quality graphical images, specifically color images of three-dimensional objects.\n",
    "\n",
    "* framebuffter and its properties"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.2.1 Programmer's View of OpenGL\n",
    "\n",
    "* shaders \n",
    "    * geometric processing\n",
    "    * rasterization of geometry\n",
    "    * lighting \n",
    "    * shading of fragments generated by rasterization\n",
    "* data used by shaders\n",
    "    * geometry in 2d and 3d \n",
    "    * texture images\n",
    "* state controlling aspects of OpenGL \n",
    "\n",
    "The call process:\n",
    "* open a *window* into the framebuffer \n",
    "* allocate an OpenGL *context*, and associate it with the window\n",
    "* make OpenGL commands to defined shaders, geometry, and textures \n",
    "* draw commands \n",
    "* control the framebuffer by reading and writing pixels"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.2.2 Implementor's View of OpenGL\n",
    "\n",
    "OpenGL is a sef of commands that control the operation of the GPU. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.2.3 Our view\n",
    "\n",
    "We view OpenGL as a *pipeline* having some programmable stages and some statedriven fixed-function stages that are invoked by a set of specific drawing opera-tions."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.3 Related APIs\n",
    "\n",
    "#### 1.3.1 OpenGL Shading Language \n",
    "\n",
    "the syntax and semantics of the programming language used to write shaders. \n",
    "\n",
    "#### 1.3.2 OpenGL ES \n",
    "\n",
    "OpenGL ES is a royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems such as mobile phones, game consoles and vehicles\n",
    "\n",
    "#### 1.3.3 OpenGL ES Shading Language\n",
    "\n",
    "#### 1.3.4 WebGL \n",
    "\n",
    "#### 1.3.5 Window System Binding \n",
    "\n",
    "OpenGL requires a companion API to create and manage \n",
    "* graphics contexts\n",
    "* windows to render into \n",
    "* other resources beyond the scope of this specification\n",
    "\n",
    "* GLX- X window System Binding \n",
    "* WGL - Microsoft Windows Bindings \n",
    "* MacOS X Windows System Bindings\n",
    "* EGL - Mobile and Embededded Device Bindings \n",
    "\n",
    "#### 1.3.6 OpenCL \n",
    "\n",
    "OpenCL is an open, royalty-free standard for cross-platform, general-purpose parallel programming of processors. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 2 OpenGL Fundamentals "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "fundamentals concepts \n",
    "* execution model\n",
    "* API syntax \n",
    "* contexts \n",
    "* threads \n",
    "* numerical representation \n",
    "* context state\n",
    "* state queries \n",
    "* the different types of object and shaders"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.1 Execution Model\n",
    "\n",
    "OpenGL (henceforth, “the GL”) is concerned only with processing data in GPU\n",
    "memory\n",
    "* rendering into a framebuffer \n",
    "* reading values stored in that framebuffer.\n",
    "\n",
    "draw primitives processed by a variety of shader programs and fixed-function processing units controlled by context state.\n",
    "\n",
    "primitives:\n",
    "* point \n",
    "* line segment\n",
    "* patch\n",
    "* polygon\n",
    "\n",
    "Context state: 可以独立的改变\n",
    "\n",
    "set state ---> draw primitives ----> other GL operation \n",
    "\n",
    "Primitives are defined by a group of one or more vertices.\n",
    "\n",
    "Data are associated with a vertex and each vertex is processed independently. \n",
    "\n",
    "command are always processed in the order in which they are received\n",
    "\n",
    "data binding occurs on call. \n",
    "\n",
    "Fundamental operations:\n",
    "\n",
    "OpenGL provides mechanisms to describe how complex geometric objects are to be rendered, rather than mechanisms to describe the complex objects themselves.\n",
    "\n",
    "* client-server\n",
    "* GL is network tansparent\n",
    "\n",
    "Issuing GL commands when a program is not current to a context results in\n",
    "undefined behavior.\n",
    "\n",
    "framebuffer:\n",
    "* a window system-provided framebutter with a current context\n",
    "    * default framebuffer \n",
    "* application-created framebuffters\n",
    "    * framebuffter objects\n",
    "    \n",
    "Two buffer is different primarily by the interface configuring and managing their state.\n",
    "    \n",
    "A context may be associated with two framefuffers, one for each of reading and drawing operations.\n",
    "\n",
    "Windows controll default framefuffer.\n",
    "\n",
    "Allocation and initializztion of GL context. \n",
    "\n",
    "Offscreen rendering\n",
    "\n",
    "command names (gl...), constants (GL_ ), types (GL)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.2 Command Syntax \n",
    "\n",
    "command name\n",
    "\n",
    "#### 2.2.1 Data Conversion For State-Setting Commands\n",
    "#### 2.2.2 Data Conversions For State Query Commands\n",
    "Query commands (begin with `Get`) return a value or values to which GL state has been set. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3 Command Execution \n",
    "\n",
    "The behavior of a single context bound to a single CPU thread.\n",
    "\n",
    "Multiple contexts to share GL objects and for each such context to be bound to a different thread\n",
    "\n",
    "* error reporting \n",
    "* command queue flushing\n",
    "* synchronization \n",
    "\n",
    "#### 2.3.1 Errors \n",
    "#### 2.3.2 Graphics Reset Recovery \n",
    "#### 2.3.3 Flush and Finish\n",
    "#### 2.3.4 Numeric Representation and Computation\n",
    "\n",
    "1. floating-point Computation\n",
    "2. 16-Bit Floating-Point Numbers\n",
    "3. Unsigned 11-Bit Floating-Point Numbers\n",
    "4. Unsigned 10-Bit Floating-Point Numbers\n",
    "5. Fixed-Point Computation\n",
    "6. General Requirements "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.4 Rendering Commands \n",
    "\n",
    "* rendering commands \n",
    "* drawing commands \n",
    "* BlitFramebuffer\n",
    "* Clear\n",
    "* ClearBuffer\n",
    "* DispatchCompute"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.5 Context State\n",
    "\n",
    "Context state is state that belongs to the GL context as a whole. \n",
    "\n",
    "Context state controls fixed-function stages of the GPU\n",
    "* clipping \n",
    "* primitive rasterization\n",
    "* framebuffer clear\n",
    "* specifies bindings of objects to the context, speicfying which objects are used during command exeution.\n",
    "\n",
    "all visible context state variables.\n",
    "\n",
    "Framebuffer is not a part of GL state.\n",
    "\n",
    "* Server state (majority, Unless otherwise specified, all state is server state)\n",
    "* client state\n",
    "\n",
    "* Each instance of context includes a complete set of server state\n",
    "* Each connection from a client to a server also includes a complete set of client state"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.6 Objects and the Object Model\n",
    "\n",
    "* Object \n",
    "* Object type\n",
    "* Object name\n",
    "* Object Model describe how most types of objects are managed. \n",
    "* Object State\n",
    "\n",
    "#### 2.6.1  Object Management\n",
    "\n",
    "1. Name Spaces, Name Generation, and Object Creation\n",
    "2. Name Deletion and Object Deletion\n",
    "3. Shared Object State\n",
    "\n",
    "#### 2.6.2 Buffer Object \n",
    "\n",
    "* data store holding a fixed-sized allocation of server memory\n",
    "* allocate \n",
    "* initialize \n",
    "* read \n",
    "* write\n",
    "* shared between the client and server and accessed simultaneously by both\n",
    "\n",
    "#### 2.6.3 Shader Objects \n",
    "\n",
    "The source and/or binary code representing part  or all of a shader program that is executed by one of the programmable stages defined by the GL \n",
    "\n",
    "* shared \n",
    "\n",
    "#### 2.6.4 Program Objects \n",
    "\n",
    "All information necessary for defining each executable is encapsulated in a program object.\n",
    "\n",
    "#### 2.6.5 Program Pipeline Objects\n",
    "\n",
    "Program pipeline objects contain a separate program object binding point for each programmable stage.\n",
    "\n",
    "Program pipeline objects are container objects including references to program objects, and are not shared. \n",
    "\n",
    "#### 2.6.6 Texture Objects \n",
    "\n",
    "Texture objects or textures include a collection of texture images built from arrays of image elements. \n",
    "\n",
    "* **texels**纹理元素\n",
    "* state\n",
    "* maybe shared \n",
    "\n",
    "#### 2.6.7 Sampler Objects \n",
    "Sampler objects contain the subset of texture object state controlling how sampling\n",
    "is performed when a shader accesses a texture.\n",
    "\n",
    "* maybe shared \n",
    "\n",
    "#### 2.6.8 Renderbuffer Objects\n",
    "\n",
    "Renderbuffer objects contain a single image in a format which can be rendered to. \n",
    "\n",
    "* attached to a framebutter\n",
    "* off-screen rendering \n",
    "* maybe shared \n",
    "\n",
    "#### 2.6.9 Framebuffer Objects \n",
    "\n",
    "* encapsulate the state of a framebuffer\n",
    "* container objects\n",
    "    + texture objects \n",
    "    + render buffer\n",
    "* not shared \n",
    "\n",
    "#### 2.6.10 Vertex Array Objects \n",
    "* container objects \n",
    "* not shared \n",
    "\n",
    "#### 2.6.11 Transform Feedback Objects \n",
    "* container objects \n",
    "* not shared \n",
    "\n",
    "#### 2.6.12 Query Objects \n",
    "* not shared \n",
    "\n",
    "#### 2.6.13 Sync Objects \n",
    "A sync object acts as a synchronization primitive – a representation of events whose\n",
    "completion status can be tested or waited upon\n",
    "\n",
    "* may be shared "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 3  Dataflow Model "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 4 Event Model "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4. 1 Sync Objects and Fences \n",
    "\n",
    "Sync Objects:\n",
    "* synchronization primitive: a representation of events whose completion status can be tested or waited upon.\n",
    "* two states\n",
    "    + signaled \n",
    "    + unsignaled \n",
    "   \n",
    "* the fence sync object "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4.2 Query Objects and Asynchronous Queries \n",
    "\n",
    "Asynchronous queries provide a mechanism to return information about the pro-\n",
    "cessing of a sequence of GL commands."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4.3 Time Queries \n",
    "\n",
    "Query objects may also be used to track the amount of time needed to fully com-\n",
    "plete a set of GL commands (a time elapsed query), or to determine the current\n",
    "time of the GL (a timer query)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 5 Shared Objects and Multiple Contexts \n",
    "\n",
    "Views act as references on the object whose data store is viewed. \n",
    "\n",
    "container objects are note shared\n",
    "* framebuffer\n",
    "* program pipeline\n",
    "* query\n",
    "* transform feedback\n",
    "* query\n",
    "* transform feedback\n",
    "* vertex array objects"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.1 Object Deletion Behavior\n",
    "\n",
    "#### 5.1.1 Side Effects of Shared Context Destruction\n",
    "#### 5.1.2 Automatic Unbinding of Deleted Objects\n",
    "#### 5.1.3 Deleted Object and Object name Lifetimes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.3 Propagating Changes to Objects\n",
    "\n",
    "GL objects contain two types of information\n",
    "* data\n",
    "* state\n",
    "\n",
    "In hardware-accelerated GL implementations, state typically lives in GPU registers, while data typically lives in GPU memory\n",
    "\n",
    "#### 5.3.1 Determing Completion of Changes to an object\n",
    "\n",
    "* directly attached: Object ---> Context \n",
    "* indirectly attached: Object ---> Object Container Object---> Current context\n",
    "* reattached: \n",
    "\n",
    "re-binding C to the current context re-attaches C and its hierarchy\n",
    "of contained objects."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 6 Buffer Objects "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* create \n",
    "* manage\n",
    "* destroy\n",
    "\n",
    "### 6.2 Creating and Modifying Buffer Object Data Stores"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 7 Programs and Shaders"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* create \n",
    "* manage\n",
    "* destroy \n",
    "\n",
    "To use a shader, shader source code is first loaded into a shader object and then **compiled**. \n",
    "\n",
    "A shader object corresponds to a stage in the rendering pipeline referred to as its shader stage or shader type.\n",
    "\n",
    "One or more shader objects are attached to a program object. The program object is then _linked_, which geerates executable code from all the compiled shader objects.\n",
    "\n",
    "\n",
    "When Program objects are bound to a shader stage, they become the current program object for that stage. \n",
    "\n",
    "The set of separable program objects current for all stages are collected in a program pipeline that must be bound for use. \n",
    "\n",
    "Shader stages:\n",
    "* vertex shaders: vertex attributes\n",
    "* tessellation control shaders: control the operation of the tessellator \n",
    "* tessellation evaluation shaders\n",
    "* geometry shaders: primitives \n",
    "* fragment shaders: rasterization\n",
    "* compute shaders: general-purpose computation for dispatched arrays of shader invocation\n",
    "\n",
    "can be created, compiled, and linked into program objects.\n",
    "\n",
    "several types of variables:\n",
    "* Uniforms\n",
    "* Buffer variables \n",
    "* Subroutine uniform variables: context state\n",
    "* Images\n",
    "* Output variables \n",
    "\n",
    "每一个 Shader 都有一个整型的编号，"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.1 Shader Objects"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.2 Shader Binaries"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.3 Program Objects"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Active variable --> GL state with other stage\n",
    "Active interface bolcks --> GL Interface with other stage\n",
    "\n",
    "current program \n",
    "\n",
    "active \n",
    "\n",
    "bound program pipeline object \n",
    "\n",
    "The executable code for an individual shader stage is taken from the current program for that stage\n",
    "\n",
    "#### 7.3.1 Program Interfaces \n",
    "\n",
    "When a program object is made part of the current rendering state, its executable\n",
    "code may communicate with other GL pipeline stages or application code through\n",
    "a variety of interfaces.\n",
    "\n",
    "Resource\n",
    "active resource, 什么是 active resource\n",
    "* variables \n",
    "* interface blocks \n",
    "* subroutines \n",
    "\n",
    "How to create active resources?\n",
    "\n",
    "How to qurery properties of the interface of a program object.\n",
    "* programInterface token\n",
    "\n",
    "##### 7.3.1.1 Naming Active Resources \n",
    "\n",
    "What good can we get from naming?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.4 Program Pipeline Objects\n",
    "\n",
    "A program pipeline object contains bindings for each shader type associating that shader type with a program object.\n",
    "\n",
    "pipeline object is a new state vector.\n",
    "\n",
    "`GenProgramPipelines` return n previously unused program pipeline object names.\n",
    "\n",
    "`BindProgramPipeLine` generate the pipeline with a unused name.\n",
    "\n",
    "#### 7.4.1 Shader Interface Matching \n",
    "\n",
    "the outputs of one stage form an interfacewith the inputs of the next stage"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.7 Atomic Counter Buffers "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.8 Shader Buffer Variables and Shader Storage Blocks \n",
    "\n",
    "Shaders can declare named __buffer variables__. \n",
    "\n",
    "Set of buffer variables are grouped into interface blocks called __shader storage blocks__\n",
    "\n",
    "__active buffer variables__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.9 Subroutine Uniform Variables\n",
    "\n",
    "Subroutine Uniform Variables is \n",
    "* context state\n",
    "* apply only to a single program stage\n",
    "\n",
    "Uniform variables is program state "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.10 Samplers \n",
    "\n",
    "__Samplers__ are special uniform to identify the texture object used for each texture lookup.\n",
    "\n",
    "The value of a sampler indicates the texture image unit being accessed. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.11 Images \n",
    "\n",
    "* special uniform\n",
    "* an integer specifying the image unit accessed. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.12 Shader Memory Access \n",
    "\n",
    "#### 7.12.1 Shader Memory Access Ordering \n",
    "\n",
    "#### 7.12.2 Shader Memory Access Synchronization \n",
    "\n",
    "访问资源就有同步的问题"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.13 Shader, Program, and Program Pipeline Queires "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 7.14 Required State \n",
    "\n",
    "The GL maintains state to indicate which shader and program object names are in use."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 8 Textures and Samplers \n",
    "\n",
    "Texturing maps a portion of one or more specified images onto a fragment or vertex. \n",
    "\n",
    "This Mapping is accomplished in shaders by sampling the color of an image at the location indicated by specified (s, t, r) texture coordinares. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 8.1 Texture Objects\n",
    "\n",
    "* named object \n",
    "* name space\n",
    "* zero reserved by the GL to represent\n",
    "\n",
    "产生新的 Texture Objects, 先找一组没有用过的名字，然后再生成对象"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 8.2 Sampler Objects \n",
    "### 8.3 Sampler Objects Queries\n",
    "### 8.4 Pixel REctangle\n",
    "### 8.5 Texture Image Specification \n",
    "### 8.6 Alternate Texture Image Specification Commands\n",
    "### 8.7 Compressed Texture Images\n",
    "### 8.8 Multisample Textures\n",
    "### 8.9 Buffer Textures\n",
    "### 8.10 Texture Parameters \n",
    "### 8.11 Texture queries \n",
    "### 8.12 Depth Component Textures\n",
    "### 8.13 Cube Map Texture Selection \n",
    "### 8.14 Texture Minification \n",
    "### 8.15 Texture magnification\n",
    "### 8.16 Combined Depth/Stencil Textures\n",
    "### 8.17 Texture Completeness\n",
    "### 8.18 Texture Views\n",
    "\n",
    "* one \n",
    "* two \n",
    "* three "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 9 Framebuffers and Framebuffer Objects"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 9.1 Framebuffer Overview\n",
    "The framebuffer consists of a set of pixels arranged as a two-dimensional array. \n",
    "\n",
    "corresponding bits from each pixel in the framebuffer are grouped together into a bitplane; each bitplane contains a single bit from each pixel. These bitplanes are grouped into several logical buffers\n",
    "\n",
    "* color buffer\n",
    "* depth buffer\n",
    "* stencil buffers buffer\n",
    "\n",
    "* front left buffer \n",
    "* front right buffer \n",
    "* back left buffer \n",
    "* back right buffer "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 9.4 Framebuffer Completeness"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 10 Vertex Specification and Drawing Commands\n",
    "\n",
    "The process of specifying attributes of a vertex and passing them to a shader is referred to as transferring a vertex to the GL.\n",
    "\n",
    "Each vertex is specified with one or more generic vertex attributes. Each attribute is specified with one, two, three, or four scalar values."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 10.1 Primitive Types\n",
    "\n",
    "* 如何组织\n",
    "* state\n",
    "\n",
    "* Points: Mode POINTS\n",
    "* Line Strips : LINE_STRIP\n",
    "* Line Loops: LINE_LOOP\n",
    "* Separate Lines: LINES\n",
    "* Triangle Strips: TRIANGLE_STRIP\n",
    "* Triangle Fans： TRIANGLE_FAN\n",
    "* Separate Triangles: TRIANGLES\n",
    "* Lines with Adjacency: LINES_ADJACENCY\n",
    "* Line Strips with Adjacency\n",
    "* Triangles with Adjacency\n",
    "* Triangle Strips with Adjacency\n",
    "* Separate Patches \n",
    "    + an ordered collection of vertices used for primitive tessellation \n",
    "    + Each patch in the series has a fixed number of vertices,\n",
    "* General Considerations For Polygon Primitives "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 10.2 Current Vertex Attribute Values\n",
    "\n",
    "**current attribute values**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 10.3 Vertex Arrays \n",
    "The buffer objects that are to be used by the vertex stage of the GL are collected\n",
    "together to form a vertex array object"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 11 Programmable Vertex Processing \n",
    "\n",
    "### 11.1 Vertex Shaders \n",
    "\n",
    "Verex shaders describe the operations that occur on vertex values and their associated data. When the program object currently in use for the vertex stage includes a vertex shader, \n",
    "\n",
    "### 11.2 Tessellation \n",
    "Tessellation is a process that reads a patch primitive and generates new primitives\n",
    "used by subsequent pipeline stages\n",
    "\n",
    "* tessellation control shaders \n",
    "    + read an input patch provided by the application\n",
    "    + emit an output patch\n",
    "    + compute the attributes of that vertex \n",
    "    + compute per-patch attributes of the output patch \n",
    "    + tessellation levels \n",
    "    + write additional per-patch attributes for use by the sessellation evaluation shader.\n",
    "* tessellation evaluation shaders\n",
    "    + subdivides a triangle or quad primitive into a collection of points, lines, or triangles \n",
    "* tessellation primitive generator \n",
    "\n",
    "* tessellation operates only on patch primitives \n",
    "* non-separable must include a vertex shader\n",
    "#### 11.2.2 Tessellation Primitive Generation \n",
    "\n",
    "* triangle tessellation\n",
    "* Quad tessellation \n",
    "* Isoline TEssellation\n",
    "\n",
    "#### 11.2.3 Tessellation Evaluation Shaders \n",
    "计算新的顶点和属性"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 11.3 Geometry Shaders \n",
    "\n",
    "* optional geometry shaders \n",
    "* Geometry shaders operate on a single primitive at a time and emit one or more output primitives. \n",
    "* The original primitive is discarded after geometry shader execution\n",
    "* after primitive assembly \n",
    "* prior to transform feedback \n",
    "* layout qualifier?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 13 Fixed-Function Vertex Post-Processing\n",
    "\n",
    "* Transform Feedback\n",
    "* Flatshading a vertex shader output means to assign all vertices of the primitive the same value for that output"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 14 Fixed-Function Primitive Assembly and Rasterization \n",
    "\n",
    "Rasterization is the process by which a primitive is converted to a two-dimensional\n",
    "image. Each point of this image contains such information as color and depth.\n",
    "\n",
    "A grid square, including its (x,y) window coordinates, z(depth), and associate data which may be added by fragment shaders, is called a fragment.\n",
    "\n",
    "Fragment shadeers determine color values for fragments, and may also modify or replace their assigned depth values. \n",
    "\n",
    "A grid square along with its z (depth) and shader output parameters is called a\n",
    "fragment\n",
    "\n",
    "Rasterization operations also refer to a fragment’s center.\n",
    "\n",
    "Multisampling is a mechanism to antialias all GL primitives: points, lines, and\n",
    "polygons."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 15 Programmable Fragment Processing"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 17 Writing Fragments and Samples to the Framebuffer"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 18 Reading and Copying Pixels"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 19 Compute Shaders "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 20 Debug Output\n",
    "\n",
    "* debug output \n",
    "* debug messages "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 21 Special Functions "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Chapter 22 Context State Queries "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## State Tables "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  },
  "latex_envs": {
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 0
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
